﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace SharedCongkak
{
    public class Store: AbstractHole
    {
        
        public Store():this("Store")
        {

        }
        public Store(string name)
        {
            Name = name;
            width = 160;
            height = 160;
            radius = 65;
            collisionRect = new Rectangle(0, 0, width, height);

        }

        public override void LoadContent(ContentManager content)
        {

            holeTex = content.Load<Texture2D>("texture/store");
            selectedHoleTex = content.Load<Texture2D>("texture/storeselected");

        }

        public override void AddSeed(Seed seed)
        {
            base.AddSeed(seed);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            if (IsHome)
            {
                if (Highlight)
                {
                    spriteBatch.Draw(holeTex, Position, Color.Yellow);
                    spriteBatch.Draw(selectedHoleTex, Position, Color.Yellow);
                }
                else
                    spriteBatch.Draw(holeTex, Position, Color.Orange);
            }
            else
            {
                spriteBatch.Draw(holeTex, Position, Color.CornflowerBlue);
                if (Highlight)
                    spriteBatch.Draw(selectedHoleTex, Position, Color.Cyan);
            }

            base.Draw(spriteBatch);
        }


    }

    public class StoreReader : ContentTypeReader<Store>
    {
        protected override Store Read(
                ContentReader input,
                Store existingInstance)
        {

            Vector2 position = input.ReadVector2();
            Store store = new Store(input.ReadString());
            store.Position = position;
            store.IsHome = input.ReadBoolean();
            store.LoadContent(input.ContentManager);
            return store;
        }
    }
}
